package com.test.entity;

public class GoodsParam {

  private String keyword; // 查询关键字

  private Integer cpage = 1; // 当前页

  private Integer pageSize = 2; // 每页显示数量

  private Integer offset; // 起始条数

  private Integer prePage ;// 上一页

  private Integer nextPage; // 下一页

  private Integer fistPage;// 首页

  private Integer lastPage;// 尾页

  private Integer totalPage;// 总页数

  private Integer total;// 总条数

  private String pageUrl;

  public String getKeyword() {

    return keyword;

  }

  public void setKeyword(String keyword) {

    this.keyword = keyword;

  }

  public Integer getCpage() {

    return cpage;

  }

  public void setCpage(Integer cpage) {

    this.cpage = cpage;

  }

  public Integer getPageSize() {

    return pageSize;

  }

  public void setPageSize(Integer pageSize) {

    this.pageSize = pageSize;

  }

  public Integer getOffset() {

    offset = (getCpage() - 1) * getPageSize();

    return offset;

  }

  public void setOffset(Integer offset) {

    this.offset = offset;

  }

  public Integer getPrePage() {

    return cpage <= 1 ? 1 : cpage - 1;

  }

  public void setPrePage(Integer prePage) {

    this.prePage = prePage;

  }

  public Integer getNextPage() {

    return cpage >= getTotalPage() ? getTotalPage() : cpage + 1;

  }

  public void setNextPage(Integer nextPage) {

    this.nextPage = nextPage;

  }

  public Integer getFistPage() {

    return 1;

  }

  public void setFistPage(Integer fistPage) {

    this.fistPage = fistPage;

  }

  public Integer getLastPage() {

    return getTotalPage();

  }

  public void setLastPage(Integer lastPage) {

    this.lastPage = lastPage;

  }

  public Integer getTotalPage() {

    return getTotal() % getPageSize() == 0 ? getTotal() / getPageSize() : getTotal() / getPageSize() + 1;

  }

  public void setTotalPage(Integer totalPage) {

    this.totalPage = totalPage;

  }

  public Integer getTotal() {

    return total;

  }

  public void setTotal(Integer total) {

    this.total = total;

  }

  public String getPageUrl() {

    pageUrl = "<a href='javascript:void(0)' onclick='fenye(1)'>首页</a>"

    + "<a href='javascript:void(0)' onclick='fenye(" + getPrePage() + ")'>上一页</a>"

    + "<a href='javascript:void(0)' onclick='fenye(" + getNextPage() + ")'>下一页</a>"

    + "<a href='javascript:void(0)' onclick='fenye(" + getLastPage() + ")'>末页</a>"

    + " 第" + getCpage() + " / " + getTotalPage() + "页 共" + getTotal() + "条";

    return pageUrl;

  }

  public void setPageUrl(String pageUrl) {

    this.pageUrl = pageUrl;

  }


}
